/*
 * IndexPositionRecord.java
 *
 * Copyright(c) 2010
 * Michael Kroez
 * kroez@studiorutton.de
 *
 * All rights reserved.
 *
 * $Id$
 * 
 */

package de.studiorutton.gerengdic.databaseaccess.records;

import de.studiorutton.gerengdic.databaseaccess.DatabaseTools;

public class IndexPositionRecord {
	private int index;
	private int viewOffset;
	private int numOfRecords;
	private int indexRecordPosition;
	
	public final static byte INDEX_POSITION_RECORD_HEADER = 0x04;
	public final static int INDEX_POSITION_RECORD_SIZE = DatabaseTools.HEADER_SIZE + DatabaseTools.INT_SIZE + DatabaseTools.INT_SIZE + DatabaseTools.INT_SIZE;

	public IndexPositionRecord( int index, int viewOffset, int numOfRecords, int indexRecordPosition ) {
		this.index = index;
		this.viewOffset = viewOffset;
		this.numOfRecords = numOfRecords;
		this.indexRecordPosition = indexRecordPosition;
	}
	
	public int getIndex() {
		return index;
	}
	
	public int getViewOffset() {
		return viewOffset;
	}
	
	public void setViewOffset( int viewOffset ) {
		this.viewOffset = viewOffset;
	}
	
	public int getNumOfRecords() {
		return numOfRecords;
	}
	
	public int getLastViewOffset() {
		return viewOffset + numOfRecords;
	}
	
	public int getIndexRecordPosition() {
		return indexRecordPosition;
	}
	
	public String toString() {
		return "Index=" + index + " ViewOffset=" + viewOffset + " numOfRecords=" + numOfRecords + " indexRecordPosition=" + indexRecordPosition + ".";
	}
}
